// 获取本地的视图文件信息，标记为延迟加载
const requireViews = require.context("../views", true, /\.view\.vue$/, "lazy"); // 本地视图文件路径

export const viewKeys = requireViews.keys();

export function hasViewFile(path) {
  return viewKeys.some(s => s.toLocaleLowerCase() === `.${path}.view.vue`.toLocaleLowerCase());
}
export async function getViewComponent(path) {
  const localView = viewKeys.find(f => f.toLocaleLowerCase() === `.${path}.view.vue`.toLocaleLowerCase());
  if (localView) {
    const reqComponent = await requireViews(localView);
    return reqComponent.default || reqComponent;
  }
}
